home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Grab Bag
/
Shareware Grab Bag.iso
/
007
/
windows.arc
/
LASTWIN.INC
< prev
next >
Wrap
Text File
|
1985-03-14
|
2KB
|
84 lines
{the following subroutines provide further window capabilities to those offered
by the Turbo compiler. Note the following constants must be defined:
first_row = the first row # to place window (upper left corner)
first_col = the first col # to place window
windowlength = the number of rows long window is to be
windowwidth = the number of columns wide
in addition the structure savreg must be defined globally and be of the register type
used by turbo for system calls
}
var
savebuf:array [1..windowwidth] of array [1..windowlength] of integer;
{read/write a character from the screen at the current cursor position}
function GetScreenChar:integer;
begin
savreg.ax := $0800; {9 -> get character/attr @ cursor}
savreg.bx := 0;
Intr($10,savreg);
GetScreenChar := savreg.ax
end;
procedure PutScreenChar(input:integer);
begin
savreg.ax := $0900 + (input and $FF); {a -> put character/attr @ cursor}
savreg.bx := input shr 8; {put the attrib in bl and 0 in bh}
savreg.cx := 1;
Intr($10,savreg)
end;
{.pa}
{open a window and save the contents away}
procedure OpenWindow;
var
i,j: Integer;
begin
{open up the window area}
window (first_col, first_row, first_col+windowwidth, first_row+windowlength);
{save off the data in the window}
for i := 1 to windowwidth do
for j := 1 to windowlength do
begin
GoToXY(i,j);
savebuf[i][j] := GetScreenChar {get a attribute/character at the cursor}
end;
{put the frame up around the window and clear that area}
GotoXY(1,1); {clear the window now}
Write(chr(218));
for i:=2 to windowwidth-1 do Write(chr(196));
Write(chr(191));
for i:=2 to windowlength-1 do
begin
GotoXY(1, i); Write(chr(179));
for j := 2 to windowwidth-1 do
Write(' ');
GotoXY(windowwidth, i); Write(chr(179));
end;
GotoXY(1, windowlength);
Write(chr(192));
for i:=2 to windowwidth-1 do Write(chr(196));
Write(chr(217));
end;
{the following procedure closes the previously opened window}
procedure closewindow;
var
i,j:integer;
begin
for i := 1 to windowwidth do
for j := 1 to windowlength do
begin
GoToXY(i,j);
PutScreenChar(savebuf[i][j])
end
end;